package com.sky.mapper;

import com.sky.entity.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;

import java.util.Map;

@Mapper
public interface UserMapper {
    // 根据openid查询用户
    User selectByOpenid(String openid);
    // 插入数据
    @Options(useGeneratedKeys = true, keyColumn = "id", keyProperty = "id")
    @Insert("insert into user (openid, create_time,name) values (#{openid}, #{createTime},#{name})")
    void insert(User user);
    // 根据id查询用户
   @Select("select * from user where id=#{userId}")
    User selectById(Long userId);
   // 统计用户数量
   //   @Select("select count(*) from user where #{beginTime} and #{endTime}")
    Integer countByMap(Map<Object, Object> map);
}
